<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单元素-上</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <style>
        body {
            margin: 20px;
        }
    </style>
</head>
<body>

<form action="" class="layui-form">
    <!--输入框-->
    <div class="layui-form-item">
        <label class="layui-form-label">输入框</label>
        <div class="layui-input-block">
            <input type="text" placeholder="请输入用户名" class="layui-input"/>
        </div>
    </div>
    <!--密码框-->
    <div class="layui-form-item">
        <label class="layui-form-label">密码框</label>
        <div class="layui-input-inline">
            <input type="password" placeholder="请输入密码" class="layui-input"/>
        </div>
        <div class="layui-form-mid layui-word-aux">辅助文字</div>
    </div>
    <!--下拉选择框-->
    <div class="layui-form-item">
        <label class="layui-form-label">下拉选择框</label>
        <div class="layui-input-block">
            <select name="city">
                <option value="">请选择城市</option>
                <option value="1">北京</option>
                <option value="2">上海</option>
                <option value="3">广州</option>
                <option value="4">深圳</option>
            </select>
        </div>
    </div>
    <!--复选框-->
    <div class="layui-form-item">
        <label class="layui-form-label">复选框</label>
        <div class="layui-input-block">
            <input type="checkbox" title="写作">
            <input type="checkbox" title="阅读" checked>
            <input type="checkbox" title="发呆">
        </div>
    </div>
    <!--开关-->
    <div class="layui-form-item">
        <label class="layui-form-label">开关</label>
        <div class="layui-input-block">
            <input type="checkbox" lay-text="ON|OFF" lay-skin="switch">
        </div>
    </div>
    <!--单选框-->
    <div class="layui-form-item">
        <label class="layui-form-label">单选框</label>
        <div class="layui-input-block">
            <input type="radio" name="gender" title="男" checked>
            <input type="radio" name="gender" title="女">
        </div>
    </div>
    <!--文本框-->
    <div class="layui-form-item">
        <label class="layui-form-label">文本框</label>
        <div class="layui-input-block">
            <textarea class="layui-textarea"></textarea>
        </div>
    </div>
    <!--按钮-->
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button lay-submit class="layui-btn">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script src="../layui/layui.js"></script>
<script>
    layui.use(['form'], () => {
        let form = layui.form;
    })
</script>
</body>
</html>
